//
//  DiamondBuyHeaderView.swift
//  NDAi
//
//  Created by 丸子 on 2024/7/2.
//

import UIKit

class DiamondBuyHeaderView: UIView {
    private lazy var backView: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor(hexString: "#FFFFFF", transparency: 0.1)
        view.allRound(10)
        return view
    }()
    
    lazy var iconIV: UIImageView = {
        let imageView = UIImageView()
        imageView.image = UIImage(named: "icon_mine_diamond")
        imageView.contentMode = .scaleToFill
        imageView.clipsToBounds = true
        return imageView
    }()
    
    lazy var moneyLb: UILabel = {
        let label = UILabel()
        label.textColor = .white
        label.font = UIFont.pingFangSCSemibold(ofSize: 30)
        label.textAlignment = .center
        label.text = "0"
        return label
    }()
    
    lazy var titleLb: UILabel = {
        let label = UILabel()
        label.textColor = UIColor(hexString: "#FFFFFF", transparency: 0.5)
        label.font = UIFont.pingFangSCRegular(ofSize: 14)
        label.textAlignment = .center
        label.text = "账户余额"
        return label
    }()
     
    override init(frame: CGRect) {
        super.init(frame: CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: 150))
        
        self.addSubviews([backView])
        backView.addSubviews([iconIV, titleLb, moneyLb])
        
        backView.snp.makeConstraints { make in
            make.top.equalToSuperview().offset(16)
            make.leading.trailing.equalToSuperview().inset(14)
            make.height.equalTo(110)
            make.bottom.equalToSuperview()
        }
        
        iconIV.snp.makeConstraints { make in
            make.centerX.equalToSuperview().offset(-20)
            make.centerY.equalToSuperview().offset(-10)
            make.width.equalTo(26)
            make.height.equalTo(20)
        }
        
        moneyLb.snp.makeConstraints { make in
            make.centerY.equalTo(iconIV)
            make.leading.equalTo(iconIV.snp.trailing).offset(6)
        }
        
        titleLb.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.top.equalTo(self.iconIV.snp.bottom).offset(20)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
